[XPU] Fix sparse-MLA metadata sync - #52066
Open
libinta wants to merge 3 commits into
Open
Conversation
xinyu-intel
reviewed
Aug 13, 2026
majian4work
reviewed
Aug 13, 2026
Contributor
|
Related. |
Member
|
land https://github.com/vllm-project/vllm/pull/52118/changes to fix this issue. thanks. |
Contributor
|
Since issue 1 was resolved by another pr, could you split issue 2 into a standalone fix? |
The shared MLA layer (mla_attention.py::forward_impl) reads
num_decodes/num_prefills/num_decode_tokens on every MLA metadata (it asserts
they are not None and uses num_decode_tokens to split MQA vs dense-MHA
tokens). The CUDA sparse backends supply these via
SparseMLACommonMetadataBuilder, but the XPU sparse backend builds its own
metadata and omitted them, so a sparse-MLA (DeepSeek DSA / GLM) run on XPU
crashed with:
'XPUMLASparseMetadata' object has no attribute 'num_decode_tokens'
Add the fields and populate them so all tokens route through the top-k sparse
MQA path (num_decode_tokens == num_actual_tokens, num_prefills == 0), which
this backend already implements for both prefill and decode. This keeps the
shared layer's num_mha_tokens at 0 and never enters the dense-MHA prefill
branch (whose prefill-only fields this backend does not provide).
XPU-only; does not touch CUDA/ROCm/CPU backends. The ragged-N FP8 block-scale
GEMM fix that previously accompanied this change is now covered upstream by
vllm-project#52118, so it is dropped here.
Signed-off-by: Libin Tang <libin.tang@intel.com>
libinta
force-pushed
the
libinta/glm_fp8_xpu_sparse_mla
branch
from
August 14, 2026 05:30
583f35d to
48ccd0b
Compare
jikunshang
approved these changes
Aug 14, 2026
Member
|
/ci run |
|
✅ Triggered Buildkite CI #83859 for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix issue below for sparse-MLA FP8 MoE models (e.g. GLM-5.2, DeepSeek DSA) on Intel GPUs.
Sparse-MLA metadata sync (xpu_mla_sparse.py): The shared MLA layer (mla_attention.py::forward_impl) unconditionally reads num_decodes/num_prefills/num_decode_tokens on every MLA metadata; the CUDA sparse backends carry them via SparseMLACommonMetadataBuilder, but the XPU sparse backend built its own metadata without them, so a sparse-MLA run on XPU crashed with "'XPUMLASparseMetadata' object has no attribute 'num_decode_tokens'". Add the fields and populate them so all tokens route through the top-k sparse MQA path (num_decode_tokens == num_actual_tokens, num_prefills == 0), which this backend already implements for both prefill and decode; this keeps num_mha_tokens at 0 and avoids the dense-MHA prefill branch (whose prefill-only fields this backend does not provide).
Purpose
Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.